package edu.njfu.wigetdemo

import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.view.View
import android.widget.Button
import kotlinx.android.synthetic.main.activity_main.*

class MainActivity : AppCompatActivity(), View.OnClickListener {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        //val button=findViewById<Button>(R.id.button)
        button.setOnClickListener(this)
        val editor:SharedPreferences.Editor=getPreferences(Context.MODE_PRIVATE).edit()
        editor.putFloat("aaa",10f)
        editor.putBoolean("bbb",true)
        editor.apply()
    }

    override fun onClick(p0: View?) {
        //TODO("Not yet implemented")
        Log.d("MainActivity","hello world!")
        val intent=Intent(this,RecyclerViewActivity::class.java)
        startActivity(intent)
    }
}
